function curry(fn,...args){
    function curried(){
        let allArgs = [...args,...arguments]
        return curry(fn,...allArgs)
    }
    curried.toString=function(){
        return fn.call(null,...args)
    }
    return curried
}
function dynamicAdd() {
    return [...arguments].reduce((prev, curr) => {
      return prev + curr
    }, 0)
}
let add = curry(dynamicAdd)
//+''是为了触发toString
console.log(add(1)(2)(4)(6)+'');